//
//  CNMineSettingController.m
//  BeeQuick_19
//
//  Created by clinging on 16/9/26.
//  Copyright © 2016年 CN Team. All rights reserved.
//

#import "CNMineSettingController.h"

#import "CNAboutMeViewController.h"

static NSString *reuseIdentifier = @"reuseIdentifier";
@interface CNMineSettingController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation CNMineSettingController

- (void)viewWillAppear:(BOOL)animated{
    //      self.navigationController.navigationBarHidden = NO;
    
//    self.tabBarController . tabBar . hidden = YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupUI];
    
}
- (void)setupUI{
    
    self.view.backgroundColor = [UIColor yellowColor];
    self.navigationItem.title = @"设置";
    
    UITableView *seetingTabView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    [self.view addSubview:seetingTabView];
    
    seetingTabView.dataSource = self;
    seetingTabView.delegate = self;
    [seetingTabView registerClass:[UITableViewCell class] forCellReuseIdentifier:reuseIdentifier];
    
    
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 1) {
        return 1;
    }
    
    return 2;
}
//每行cell的标题
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier forIndexPath:indexPath];
    
    
    if (indexPath.section == 0 && indexPath.row == 0) {
        cell.textLabel.text = @"关于我们";
    }
    if (indexPath.section == 0 && indexPath.row == 1) {
        cell.textLabel.text = @"清除缓存";
    }
    
    if (indexPath.section == 1 ) {
        cell.textLabel.text = @"退出当前账号";
    }
    
    //    UILabel *loadLabel = [[UILabel alloc]init];
    //
    //    loadLabel.text = @"7.36M";
    
    if (indexPath.section == 0 && indexPath.row == 0 ){
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    
    
    if (indexPath.section == 1 ) {
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //    NSLog(@"%ld   %ld",indexPath.section,(long)indexPath.row);
    
    if (indexPath.section == 0 && indexPath.row == 0) {
        
        CNAboutMeViewController *settingVc = [[CNAboutMeViewController alloc]init];
        
        [self.navigationController pushViewController:settingVc animated:YES];
        
    }
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 
 
 
 */

@end
